use tauri::{
    plugin::{Builder, TauriPlugin},
    Manager, Runtime,
};

mod commands;
mod error;
mod models;
mod tools;

use commands::*;
pub use error::{Error, Result};
pub use models::*;

/// Initializes the plugin.
pub fn init<R: Runtime>() -> TauriPlugin<R> {
    Builder::new("sqlite")
        .invoke_handler(tauri::generate_handler![
            open,
            close,
            execute,
            get_columns,
            insert,
            delete,
            update,
            query,
        ])
        .setup(|app, _api| {
            app.manage(SqliteState::default());
            Ok(())
        })
        .build()
}
